import {NgModule} from '@angular/core';
import {RouterModule, Routes} from '@angular/router';
import {HerosComponent} from '../../components/heros/heros.component';
import {DashboardComponent} from '../../components/dashboard/dashboard.component';
import {HeroDetailComponent} from '../../components/hero-detail/hero-detail.component';

/*通过访问路径来进行组件限制*/
const routes: Routes = [
  {path: 'dashboard', component: DashboardComponent},
  {path: 'detail/:id', component: HeroDetailComponent},
  {path: 'heroes', component: HerosComponent}
];

@NgModule({
  imports: [RouterModule.forRoot(routes)],
  exports: [RouterModule]
})
export class AppRoutingModules {
}
